﻿using AutoMapper;
using Comm100.Application.Services;
using Comm100.Framework.Auditing;
using Comm100.Framework.Authorization;
using Comm100.Public.Audit;
using Bot.Application.Dto;
using Bot.Application.Services;
using Bot.Domain.Bo;
using Bot.Domain.Entities;
using Bot.Domain.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
using Bot.Domain;
using Bot.Domain.Enum;
using Comm100.Framework.Exceptions;

namespace Bot.Application.Languages.Service
{
    public class LanguageAppService : BaseAppService, ILanguageAppService
    {
        private ILanguageDomainService _domainService;

        public LanguageAppService(ILanguageDomainService domainService) : base()
        {
            this._domainService = domainService;
        }

        public IEnumerable<LanguageDto> GetList(string type)
        {
            EnumLanguageType temp; 
            if (Enum.TryParse<EnumLanguageType>(type, true, out temp))
            {
                IEnumerable<Language> list = _domainService.List(temp);
                return Mapper.Map<IEnumerable<LanguageDto>>(list);
            }

            throw new InvalidParameterException("engineType", type, "dialogflow or chloe");
        }
    }
}
